-- card: 3700 from stack: in -- bmap block id: 2889 -- flags: 0000 -- background id: 2593 -- name: ----- HyperTalk script ----- on openCard global initScroll put 0 into initScroll MultiScroll 0,"1,card","3,card","4,card" end openCard on idle global initScroll repeat with i = 1 to 3 get the scroll of card field i if it is not initScroll then put it into initScroll MultiScroll it,"1,card","3,card","4,card" end if end repeat pass idle end idle -- part 3 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=47 top=58 right=301 bottom=93 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Hello 3 -- part 4 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=76 top=58 right=301 bottom=195 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Hello 4 -- part 1 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=178 top=58 right=301 bottom=460 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 16 -- part name: Hello -- part 5 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=443 top=58 right=301 bottom=460 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: MultiScroll ----- HyperTalk script ----- on mouseDown global initScroll put the rect of me into myRect MultiScroll myRect,"1,card","3,card","4,card" put the scroll of card field id 1 into initScroll end mouseDown on mouseWithin MultiScroll Init end mouseWithin on mouseLeave MultiScroll UnInit end mouseLeave -- part 11 (field) -- low flags: 81 -- high flags: 2004 -- rect: left=41 top=52 right=307 bottom=471 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Reminder ----- HyperTalk script ----- on mouseUp set lockScreen to true hide card btn "Oscar" hide card field "Reminder" end mouseUp -- part 10 (button) -- low flags: 80 -- high flags: 0000 -- rect: left=46 top=54 right=89 bottom=83 -- title width / last selected line: 0 -- icon id / first selected line: 5155 / 5155 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Oscar -- part 12 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=193 top=312 right=334 bottom=331 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: News From Oscar ----- HyperTalk script ----- on mouseUp if visible of card field "Reminder" is true then set lockScreen to true hide card btn "Oscar" hide card field "Reminder" else set lockScreen to true show card field "Reminder" show card btn "Oscar" end if end mouseUp -- part contents for card part 4 ----- text ----- MultiScroll Intro Create Fields Make Button Put a Carriage Return after each line in the fields Create a Mousedown Handler Read this if you're obsessive-compulsive Read this if you're VERY picky. Okay, fine. Coordinating Fields against meddling Multiscroll's third mode Idle Handler That's All The Author -- part contents for card part 3 ----- text ----- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 -- part contents for card part 1 ----- text ----- MultiScroll XCMD Version 1.0 •••••••• Multiple scrolling fields in HyperCard have been a pain in the neck for me. All my HyperTalk attempts to implement them have been slow and unMac-like. I was thus motivated to create the Multiscroll XCMD. •••••••• To use it, just line up the scrolling fields that you wish linked so that they overlap and only one scrollbar is showing. Make sure the wide margins and line height are set the same in each field, and that the fields are the same height. •••••••• Next, create a transparent button which is exactly the size of your remaining visible scrollbar, i.e., 17 pixels wide and the height of the entire field. Make sure Show Name and Auto Hilite are off. Place it directly over the scrollbar. The idea here will be to use this button to intercept mouse clicks and to have it handle the scrolling via MultiScroll. •••••••• MultiScroll will use the number of lines in the field in its calculations, so you must make sure each line of text has a carriage return after it. This is easy for most things you would want multiple scrolling fields for, but something like this text needs to be attended to with intentional carriage returns, otherwise the field will not scroll all the way down. This is only necessary in the primary field (with the scrollbar showing). In fact, you could make a dummy field with just carriage returns in it and "underlap" it so just the scrollbar was showing, instead of placing returns at the end of each text line in this field. •••••••• So create a MOUSEDOWN handler in the button's script. Please take a look at the handler in the script of the button overlying this scrollbar for an example. The first parameter of Multiscroll must be the rect of the button. All the rest represent the involved fields, starting with the one whose scrollbar is being used. Each field parameter should be enclosed in quotation marks, and should contain two "sub-parameters." The first is the field ID and the second is "card" or "bkgnd" depending on the type of field (again, see this field's button). •••••••• For the true obsessive-compulsive, you will note that in a real scrolling field, you get the arrow cursor when you enter the scrollbar. Well, MultiScroll has another mode using one parameter. The "Init" parameter will give you the arrow cursor, and the "Uninit" parameter will return you to the browse tool cursor. Use these in mouseWithin and mouseLeave handlers respectively in the scrollbar button. •••••••• Note for the hopeless obsessive-compulsive: Unlike the real thumb box, this one does nothing when there is a single click in it with no dragging. Also, if you notice the light grey scrollbar background shifting slightly when you click on the thumb box, try widening or reducing the width of the field by a few pixels. The proper appearance of the top line of pixels in the light grey portion of the scrollbar is 010001000100010. Make sure you reposition the button to lie directly over the scrollbar if you do this. If you don't know what I'm talking about, then forget about it and rest assured that you are mentally healthy. •••••••• Okay, this setup will now simulate a single scrolling field's actions nearly perfectly, except of course, the arrows will scroll a little slower since the XCMD still needs to set multiple scrolls, and this is slow in HyperCard. •••••••• Why am I still writing? Well, we still need to coordinate the fields for when they are out of our control, i.e., if some hapless user does a find command and forces one field's scroll down. We want the other fields to catch up. To this end, I have declared a global variable named "initScroll" into which I put 0 on openCard. •••••••• MultiScroll has a third additional mode which is useful here. If you put an integer instead of a rect in the first parameter, it will set the scrolls to that integer. Take a look at the openCard card script to see how we use this to set the scrolls to 0 on openCard. •••••••• Finally, I use this mode in an idle handler in the card script which checks the fields against initScroll and resets them if necessary. Notice that we also keep initScroll updated from the scrollbar button script. •••••••• That's all there is to it. Very simple compared to other methods. This XCMD is free and in the public domain. I would appreciate your crediting me in your stacks if you use it since this little bit of narcissism is my only reward. •••••••• Oscar F. Hills 34 Maplewood Terrace Hamden, CT 06514 (203) 287-1913 CIS => 73317,3005 GEnie => O.HILLS -- part contents for card part 11 ----- text ----- For those of you who have my automatic disk cataloging stack, AutoCat 4.01 (or my primitive version, Auto Floppy Log), I would like to announce the planned release of AutoCat 5.0 towards the end of the summer, 1988 that is. The design is all new, and the stack is menu driven to reduce clutter. Multiscroll is just one of the many externals used to polish up AutoCat. It will include printing and report generating externals which will allow the user to print out disk catalogs or send them to a file, or to search the entire collection extracting the selected items for printing or other purposes. Of course you'll still be able to do powerful searches, display a file's pathway graphically, and launch any file from the catalogs. AutoCat 5.0 will be free to registered users of AutoCat 4.01, and may not be available by any other route since shareware fees don't even cover my phone bill at this point. Register today!